#ifndef OUTLINE_CONTAINER_HPP
#define OUTLINE_CONTAINER_HPP

//------------------------------------------------------------------------------
// Fichier d'entête utilisés
//------------------------------------------------------------------------------
#include "Outline.hpp"
#include "RGBImage.hpp"
#include <list>

namespace ImageAnalysis
{

//----------------------------------------------------------------------
//
//----------------------------------------------------------------------
class OutlineContainer
{
public:
		//----------------------------------------------------------------------
		// Structure
		//----------------------------------------------------------------------
		typedef std::list<Outline*>::iterator TOutlineContainerIterator;

		enum MergeType{START1_END2, START1_START2, END1_START2, END1_END2 };

		//----------------------------------------------------------------------
		// Constructeur
		//----------------------------------------------------------------------
		OutlineContainer( int width, int height );

		//----------------------------------------------------------------------
		// Destructeur
		//----------------------------------------------------------------------
		virtual ~OutlineContainer();

		//----------------------------------------------------------------------
		//
		//----------------------------------------------------------------------
		int GetWidth( );

		//----------------------------------------------------------------------
		//
		//----------------------------------------------------------------------
		int GetHeight( );

		//----------------------------------------------------------------------
		//
		//----------------------------------------------------------------------
		int GetNumberOfOutline( );

		//----------------------------------------------------------------------
		//
		//----------------------------------------------------------------------
		void MergeOutline( Outline* outline1, Outline* outline2, MergeType type );

		//----------------------------------------------------------------------
		//
		//----------------------------------------------------------------------
		void AddOutline( Outline* outline );

		//----------------------------------------------------------------------
		//
		//----------------------------------------------------------------------
		void RemoveOutline( TOutlineContainerIterator& iterator )
		{
			outlineList.erase( iterator );
		}

		//----------------------------------------------------------------------
		// Méthode
		//----------------------------------------------------------------------
		TOutlineContainerIterator GetStartOutline( ) { return outlineList.begin(); }

		//----------------------------------------------------------------------
		//
		//----------------------------------------------------------------------
		TOutlineContainerIterator GetEndOutline( ) { return outlineList.end(); }

		//----------------------------------------------------------------------
		//
		//----------------------------------------------------------------------
		void LogPrint( );

		//----------------------------------------------------------------------
		//
		//----------------------------------------------------------------------
		void ImagePrint( RGBImage* image );
private:
		//----------------------------------------------------------------------
		//
		//----------------------------------------------------------------------
		typedef std::list<Outline*> TOutlineList;
		TOutlineList outlineList;

		//----------------------------------------------------------------------
		//
		//----------------------------------------------------------------------
		int imageWidth;
		int imageHeight;

		//----------------------------------------------------------------------
		// Constructeur par copie et oprérateur d'affectation en privée pour
		// interdire leur utilisation
		//----------------------------------------------------------------------
		OutlineContainer( const OutlineContainer& copy);
		OutlineContainer& operator=( const OutlineContainer& copy );
};

}

#endif //OUTLINE_CONTAINER_HPP
